<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="Route_Default" Title="Untitled Page" %>

<%@ Register Assembly="PietschSoft.VE" Namespace="PietschSoft.VE" TagPrefix="PietschSoftVE" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <h1>Get a Route</h1>
    <PietschSoftVE:Map runat="server" ID="Map1" Width="600" Height="400" Zoom="6" Latitude="47.67" Longitude="-122.37" /><br />
    <br />
    <asp:Button runat="server" ID="btnAttachOnGotRoute" Text="Attach JavaScript Event to Show Directions" OnClick="btnAttachOnGotRoute_Load" />
    
    <script type="text/javascript">
        function onGotRoute(route)
        {
            var routeinfo="Route info:\n\n";
            routeinfo+="Total distance: ";
            routeinfo+=route.Itinerary.Distance+" ";
            routeinfo+=route.Itinerary.DistanceUnit+"\n";
            var steps="";
            var len = route.Itinerary.Segments.length;
            for(var i = 0; i < len ;i++)
            {
                steps+=route.Itinerary.Segments[i].Instruction+" -- (";
                steps+=route.Itinerary.Segments[i].Distance+") ";
                steps+=route.Itinerary.DistanceUnit+"\n";
            }
            routeinfo+="Steps:\n"+steps;
            alert(routeinfo);
        }
    </script>

</asp:Content>
